package com.hs.srm.admin.modules.requisition.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.hs.srm.admin.modules.abnormalquality.entity.AbnormalQualityEntity;
import com.hs.srm.admin.modules.bills.entity.ScmBillsEntity;
import com.hs.srm.admin.modules.orders.vo.ScmPoItemVo;
import com.hs.srm.admin.modules.requisition.dao.SampleOrderReportDao;
import com.hs.srm.admin.modules.requisition.entity.SampleOrderReportEntity;
import com.hs.srm.admin.modules.requisition.service.SampleOrderReportService;
import com.hs.srm.admin.modules.sampletest.service.SampleScmPoItemService;
import com.hs.srm.base.common.utils.QueryParam;
import com.hs.srm.common.utils.PageUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Description sqe试用报告
 * @Author xwx
 * @Date 2020-08-25
 */
@Service("sampleOrderReportServiceImpl")
public class SampleOrderReportServiceImpl extends ServiceImpl<SampleOrderReportDao, SampleOrderReportEntity> implements SampleOrderReportService {

    @Override
    public PageUtils selectDetailPage(Map<String, Object> params) {
        String vendorCode = (String) params.get("vendorCode");
        String materialCode = (String) params.get("materialCode");
        String materialDesc = (String) params.get("materialDesc");
        Page<SampleOrderReportEntity> page = this.selectPage(
                new QueryParam<SampleOrderReportEntity>(params).getPage(),
                new EntityWrapper<SampleOrderReportEntity>()
                        .eq(StringUtils.isNotBlank(vendorCode), "vendor_code", vendorCode)
                        /*.like(StringUtils.isNotBlank(vendorName), "vendor_name", vendorName)*/
                        .like(StringUtils.isNotBlank(materialDesc), "material_desc", materialDesc)
                        /*.ge(StringUtils.isNotBlank(startDate), "submit_date", startDate)
                        .le(StringUtils.isNotBlank(endDate), "submit_date", endDate)*/
                        .eq(StringUtils.isNotBlank(materialCode), "material_code", materialCode)
                        .eq("state_", 1)
        );
        return new PageUtils(page);
    }

}
